﻿using UnityEditor;
using UnityEditor.UI;

namespace Mars.MeshUI
{
    [CustomEditor(typeof(SuperText))]
    public class SuperTextEditor : TextEditor
    {
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            var text = target as SuperText;
            if (text == null)
            {
                return;
            }
            text.transferUVMesh = EditorGUILayout.Toggle("TransferUVMesh", text.transferUVMesh);
            if (text.material)
            {
                var fontTex = text.material.GetTexture("_FontTex");
                if (fontTex == null)
                {
                    text.material.SetTexture("_FontTex", text.font.material.mainTexture);
                }
            }
        }
    }
}